package com.caishi.lkx.exam.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.caishi.lkx.exam.ienum.type.PackageTagType;
import com.zzw.common.entity.impl.BaseEntity;
import com.zzw.common.service.model.NameModel;
import com.zzw.common.service.model.base.SortModel;
import com.caishi.lkx.order.IAssetsModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Schema(title = "套餐管理")
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "ex_package", autoResultMap = true)
public class PackageModel extends BaseEntity<PackageModel> implements NameModel<PackageModel, String>, SortModel<PackageModel>, IAssetsModel<PackageModel, String> {
    private String name;
    @Schema(title = "排序")
    private Integer sort;
    /**
     * 行业id
     * 值为"gjtk"时表示考试为高教题库
     */
    @Schema(title = "行业id 值为gjtk时表示考试为高教题库")
    private String industryId;
    @Schema(title = "考试id")
    private String examId;
    @Schema(title = "原价/分")
    private Long price;
    @Schema(title = "折扣价/分")
    private Long discountPrice;
    @Schema(title = "代理价/分")
    private Long agentPrice;
    @Schema(title = "天猫价/分")
    private Long tmPrice;
    @Schema(title = "标签ids")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<String> tagIds;
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<String> introduce;

    private String coverUrl;

    //    @Schema(title = "skuIds")
//    @TableField(typeHandler = JacksonTypeHandler.class)
//    private List<String> skuAttrIds;
    @Schema(title = "有效天数")
    private Integer days;
    @Schema(title = "有效日期")
    private LocalDate endDate;
    private String remark;
    @Schema(title = "是否上下架")
    private Boolean enable;

    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, Object> skuAttrs;

    @Schema(title = "是否推荐")
    private Boolean recommend;


    //平台id，逗号分割，管理员分配
    private String groupIds;

    @TableField(exist = false)
    private String industryName;
    @TableField(exist = false)
    private String examName;
    @TableField(exist = false)
    private List<String> tagNameList;
    @TableField(exist = false)
    private List<PackageTagType> tagTypeList;
    @TableField(exist = false)
    private List<String> skuAttrNameList;
    @TableField(exist = false)
    private String examType;
    @TableField(exist = false)
    private List<PackageSkuModel> skuModels;

    @TableField(exist = false,typeHandler = JacksonTypeHandler.class)
    private List<String> productIds;

}
